//
//  HeaderTableViewCell.m
//  SnailPost
//
//  Created by Q on 16/3/12.
//  Copyright © 2016年 抠泥ser. All rights reserved.
//

#import "HeaderTableViewCell.h"
#import <Masonry.h>
#define CHEIGHT self.contentView.frame.size.height
#define CWIDTH self.contentView.frame.size.width

@implementation HeaderTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.sv = [[UIView alloc] init];
        [_sv NightWithType:UIViewColorTypeNormal];
        [self.contentView addSubview:_sv];
        
        self.imgsrcImageView = [[UIImageView alloc] init];
        // _imgsrcImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_imgsrcImageView];
        
        self.titleLabel = [[UILabel alloc] init];
        _titleLabel.textColor = [UIColor whiteColor];
        // _titleLabel.backgroundColor = [UIColor redColor];
        [_imgsrcImageView addSubview:_titleLabel];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    // Masonry 适配
    [_sv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    
    [_imgsrcImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(_sv);
    }];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(_imgsrcImageView).with.insets(UIEdgeInsetsMake(CHEIGHT /5 * 4, 10, 10, 10));
    }];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
